package io.admin.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.admin.common.service.impl.CrudServiceImpl;
import io.admin.modules.sys.dao.FileUrlDao;
import io.admin.modules.sys.dto.FileUrlDTO;
import io.admin.modules.sys.entity.FileUrlEntity;
import io.admin.modules.sys.service.FileUrlService;
import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 文件地址管理表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2024-07-06
 */
@Service
public class FileUrlServiceImpl extends CrudServiceImpl<FileUrlDao, FileUrlEntity, FileUrlDTO> implements FileUrlService {

    @Override
    public QueryWrapper<FileUrlEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String keysId = (String)params.get("keysId");
        String url = (String)params.get("url");
        QueryWrapper<FileUrlEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.eq(StrUtil.isNotBlank(url), "url", url);
        wrapper.eq(StrUtil.isNotBlank(keysId), "keys_id", keysId);
        return wrapper;
    }


}